import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
//服务器端：接收到的数据在控制台输出

public class TCP_Demo2_server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(10001);
        Socket accept = serverSocket.accept();
//        InputStream acceptInputStream = accept.getInputStream();
        //将字节输入流 包装成 字符缓冲输入流
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        String line;
        while( (line = bufferedReader.readLine()) != null){
            System.out.println(line);
        }
        serverSocket.close();
    }
}
